{% extends "admin/base_site.html" %}
{% load i18n %}

{% block extrastyle %}{% load adminmedia %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{{ MEDIA_REAL_ESTATE }}admin/css/login.css" />{% endblock %}

{% block content %}

<form action="{{ app_path }}" method="post" id="login-form" class="form-signin {% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %} errors {% endif %}">
  {% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %}
  <div class="alert alert-error">
    <h4> {% trans 'Warning' %}! </h4>  
    {% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
  </div>
  {% endif %}

  {% if form.non_field_errors or form.this_is_the_login_form.errors %}
  {% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %}
  <div class="alert alert-error">
    <h4> {% trans 'Warning' %}! </h4>  
    {{ error }}
  </div>
  {% endfor %}
  {% endif %}

  <h2 class="form-signin-heading"> {{ title }} </h2>
  {% csrf_token %}
  <div class="control-group">
    {% if not form.this_is_the_login_form.errors %}{{ form.username.errors }}{% endif %}
    <input type="text" class="input-block-level" maxlength="30" name="username" id="id_username" placeholder="E-mail" />
  </div>
  <div class="control-group">
    {% if not form.this_is_the_login_form.errors %}{{ form.password.errors }}{% endif %}
    <input type="password" class="input-block-level" id="id_password" name="password" placeholder="Password" />
    <input type="hidden" name="this_is_the_login_form" value="1" />
    <input type="hidden" name="next" value="{{ next }}" />
  </div>
  <div class="control-group">
    <label>&nbsp;</label><input type="submit" class="btn btn-primary" value="{% trans 'Log in' %}" />
  </div>
</form>

<script type="text/javascript">
document.getElementById('id_username').focus()
</script>

{% endblock %}
